home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / john / hc_showd.hqx / ShowDialog XCMD 1.4 / card_10122.txt < prev    next >
Encoding:
Text File  |  1989-08-30  |  5.0 KB  |  170 lines

  1. -- card: 10122 from stack: in.4
  2. -- bmap block id: 10446
  3. -- flags: 0000
  4. -- background id: 2607
  5. -- name: 
  6. ----- HyperTalk script -----
  7. on closeCard
  8.   put empty into cd fld "Comment"
  9.   hide cd fld "Info"
  10.   set scroll of cd fld "Info" to 0
  11. end closeCard
  12.  
  13.  
  14. -- part 1 (button)
  15. -- low flags: 00
  16. -- high flags: A003
  17. -- rect: left=184 top=285 right=307 bottom=329
  18. -- title width / last selected line: 0
  19. -- icon id / first selected line: 0 / 0
  20. -- text alignment: 1
  21. -- font id: 0
  22. -- text size: 12
  23. -- style flags: 0
  24. -- line height: 16
  25. -- part name: Make PICT Resource
  26. ----- HyperTalk script -----
  27. on mouseUp
  28.   hide me
  29.   put "Select the object to make into a PICT..." into cd fld "Comment"
  30.   put Ants() into theRect
  31.   if theRect is empty then
  32.     put empty into cd fld "Comment"
  33.     show me
  34.     exit mouseUp
  35.   end if
  36.   put empty into cd fld "Comment"
  37.   choose select tool
  38.   drag from item 1 of theRect,item 2 of theRect to item 3 of theRect,item 4 of theRect -- with optionKey
  39.   doMenu "Copy Picture"
  40.   choose browse tool
  41.   ShowDialog 2,5740,"Please assign a unique ID and name to your PICT resource...","","",""
  42.   if the result is empty then
  43.     show me
  44.     exit mouseUp
  45.   end if
  46.   put the result into temp
  47.   if item 1 of temp is empty then
  48.     put 0 into theID
  49.   else put item 1 of temp into theID
  50.   put item 2 of temp into theName
  51.   ClipToPICT theID,theName
  52.   if word 1 of the result = "Error:" then
  53.     put the result into cd fld "Comment"
  54.     show me
  55.     exit mouseUp
  56.   end if
  57.   put "The new PICT resource is ID" && the result into cd fld "Comment"
  58.   show me
  59. end mouseUp
  60.  
  61.  
  62.  
  63. -- part 2 (field)
  64. -- low flags: 01
  65. -- high flags: 0000
  66. -- rect: left=4 top=260 right=280 bottom=504
  67. -- title width / last selected line: 0
  68. -- icon id / first selected line: 0 / 0
  69. -- text alignment: 1
  70. -- font id: 3
  71. -- text size: 12
  72. -- style flags: 0
  73. -- line height: 16
  74. -- part name: Comment
  75.  
  76.  
  77. -- part 3 (button)
  78. -- low flags: 00
  79. -- high flags: 2000
  80. -- rect: left=320 top=30 right=55 bottom=350
  81. -- title width / last selected line: 0
  82. -- icon id / first selected line: 25002 / 25002
  83. -- text alignment: 1
  84. -- font id: 0
  85. -- text size: 12
  86. -- style flags: 0
  87. -- line height: 16
  88. -- part name: Huh?
  89. ----- HyperTalk script -----
  90. on mouseUp
  91.   lock screen
  92.   if the visible of cd fld "Info" then
  93.     hide cd fld "Info"
  94.     set scroll of cd fld "Info" to 0
  95.     unlock screen with zoom in
  96.   else
  97.     put empty into cd fld "Comment"
  98.     show cd fld "Info"
  99.     unlock screen with zoom out
  100.   end if
  101. end mouseUp
  102.  
  103.  
  104.  
  105. -- part 4 (field)
  106. -- low flags: 81
  107. -- high flags: 2007
  108. -- rect: left=53 top=72 right=258 bottom=443
  109. -- title width / last selected line: 0
  110. -- icon id / first selected line: 0 / 0
  111. -- text alignment: 0
  112. -- font id: 3
  113. -- text size: 10
  114. -- style flags: 0
  115. -- line height: 13
  116. -- part name: Info
  117. ----- HyperTalk script -----
  118. on mouseUp
  119.   lock screen
  120.   hide cd fld "Info"
  121.   set scroll of cd fld "Info" to 0
  122.   unlock screen with zoom in
  123. end mouseUp
  124.  
  125.  
  126. -- part contents for background part 2
  127. ----- text -----
  128. PICT Maker
  129.  
  130. -- part contents for card part 4
  131. ----- text -----
  132. HyperCard itself is an excellent painting application.  So if you prefer, prepare your artwork on this card and click the "Make PICT Resource" button.  Your artwork will be converted into a PICT resource and saved into this stack.  If you want to make color PICTs or use the paint/draw method as described on a previous card you'll still have to use ResEdit.
  133.  
  134. PICT Maker uses an XFCN called Ants that returns the coordinates of a rectangle drawn out with the mouse and an XMCD called ClipToPICT to copy whatever picture is on the clipboard into a PICT resource and place it in the current stack.
  135.  
  136. The arguments of ClipToPICT XCMD are:
  137. ClipToPICT <new PICT resource ID>,<new PICT name>
  138.  
  139. where
  140. <new PICT resource ID> is the resource ID number for the new PICT;
  141. <new PICT name> is the name of the new PICT resource.
  142.  
  143. If you pass "0" (that's a zero) as the first parameter, ClipToPICT will assign its own unique ID to the new resource.
  144.  
  145. If you leave the second parameter empty (that doesn't mean that you can OMIT the second parameter) then the new PICT will be unnamed.
  146.  
  147. If everything goes alright the ID of the new PICT resource will be returned in "the result."  If something goes wrong the following errors are returned in the result:
  148.  
  149. Error:  You must provide 2 parameters (PICT ID and name)!
  150. Error:  That PICT resource ID already exists!
  151. Error:  That PICT name already exists!
  152. Error:  There isn't a picture on the clipboard!
  153. Error:  Unable to open the stack!
  154.  
  155. Any disk related errors will be reported by
  156. Error:  <OSError>
  157. where <OSError> is one of the standard Macintosh operating system error codes.  The ones that you potentially will encounter with ClipToPICT are:
  158. -34:  disk full
  159. -44:  disk locked
  160. -61:  file locked
  161.  
  162. As you can deduce from the error messages, ClipToPICT will not write over a previously existing PICT resource if it has the same ID or name as the new one.  If there isn't anything on the clipboard (or there is text), ClipToPICT will exit without creating a resource.
  163.  
  164. Ants XFCN 1.0 and 
  165. ClipToPICT XCMD 1.1 are Copyright┬⌐ 1988 by Jay Hodgdon
  166.  
  167.  
  168. -- part contents for background part 7
  169. ----- text -----
  170. 32